/**
 * This file is part of 1genia trampoline
 * Copyright (C) 2007 - 2008 1genia (contact@1genia.com)
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; version 3 of the License. 
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details. 
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; see the file COPYING.TXT.  If not,
 * write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301, USA. 
 **/
/**
 * 
 */
package com.genia.toolbox.projects.csv.business.util;

import java.io.File;
import java.util.List;

import com.genia.toolbox.basics.exception.technical.TechnicalException;
import com.genia.toolbox.basics.exception.technical.TechnicalIOException;
import com.genia.toolbox.projects.csv.bean.CsvResultList;
import com.genia.toolbox.projects.csv.bean.FolderDescriptor;

/**
 * utility interface for managing csv files and data.
 */
public interface CsvUtils
{

  /**
   * for the given folder, write on the working file the csv columns (headers).
   * 
   * @param pathToFile
   *          the {@link File} representation of the path to the csv file to
   *          write
   * @param columns
   *          {@link List} of column names
   * @throws TechnicalException
   *           if an error occured
   */
  public void writeCsvHeaders(File pathToFile, List<String> columns)
      throws TechnicalException;



  /**
   * for the given folder, write on the working file the csv columns (headers)
   * with some comments after the columns line.
   * 
   * @param pathToFile
   *          the {@link File} representation of the path to the csv file to
   *          write
   * @param columns
   *          {@link List} of column names
   * @param comments
   *          the comments to write with the column names
   * @throws TechnicalException
   *           if an error occured
   */
  public void writeCsvHeaders(File pathToFile, List<String> columns, List<String> comments)
      throws TechnicalException;



  /**
   * read the csv working file for the given folder, and return readed data.
   * 
   * @param folderDescriptor
   *          the description of the folder to parse
   * @param pathToFile
   *          the {@link File} representation of the path to the csv file to
   *          read
   * @return a {@link CsvResultList} object
   * @throws TechnicalException
   *           if an error ocur
   */
  public CsvResultList readCsvData(FolderDescriptor folderDescriptor, File pathToFile)
      throws TechnicalException;



  /**
   * write a readme file at the base path.
   * 
   * @param pathToFile
   *          the {@link File} representation of the path to the readme file to
   *          write
   * @param texts
   *          the {@link List} of texts to write
   * @throws TechnicalIOException
   *           if an io error ocur
   */
  public void writeReadmeTexts(File pathToFile, List<String> texts)
      throws TechnicalIOException;

}
